package dao.impl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import dao.BaseDao;
import dao.BranchesDao;
import dao.CityAreaDao;
import entity.CityArea;


public class CityAreaDao_impl extends BaseDao implements CityAreaDao{
	Connection conn = null;
	ResultSet set = null;
	PreparedStatement tmt = null;
		
		@Override
		public List<CityArea> select() {
			List<CityArea> l = new ArrayList<CityArea>();
			try {
				String sql = "select * from CityArea   ";
				conn = getConnection();
			 tmt = conn.prepareStatement(sql);
			set = 	tmt.executeQuery();
			while(set.next())
			{
				CityArea a= new CityArea();
				
				a.setName(set.getString("name"));
				
			    a.setId(set.getInt("id"));
			  
			    l.add(a);
			}
			} catch (Exception e) {
				e.printStackTrace();
			}
			return l;
		}

	

}
